Skip to content

Add JSON Schema checks for output acceptance - #6383

Merged
markstuart-oai merged 3 commits into
v1-alphafrom
codex/v1-validated-json
Dec 3, 2026
Merged

markstuart-oai merged 3 commits into
v1-alphafrom
codex/v1-validated-json

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds json_schema_check, a reusable check for accept_output that validates settled JSON against an application schema. The helper supports a bounded subset of JSON Schema, checks numeric constraints with exact arithmetic, and rejects recursive or excessive reference expansion during construction. See the docstring for supported features and resource limits. Applications control acceptance and retries. The check leaves the candidate text unchanged.

Test plan

All 81 isolated tests in test_json_output.py passed, covering runs and streams, optional fields, defaults, decimal multiples, ordinary field names, recursive references, acyclic reference multiplication, and input budgets.

The full verification script ran on all five changes together. Formatting, lint, mypy for Linux and Windows, and Pyright passed. All 325 focused tests passed.

make tests reported 504 passes and five failures involving a command hook, sandbox file writes, and a subagent. The same five tests failed on unmodified v1-alpha. This workspace blocks user namespace mapping.

Issue number

None

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners December 2, 2026 23:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T00:16:25.349041Z 511f007 New commits
🔒 Security Review ✅ Completed 2026-12-03T00:17:53.490764Z 511f007 New commits

Security findings

Advisory findings (2)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 58eff6912a

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actionable findings. Reviewed schema isolation, local-reference restrictions, non-finite and duplicate-key JSON rejection, unresolved references, and output-acceptance integration.

Comprehensive static review with independent review. No candidate code or tests were run locally. Hosted CI has no failures observed; some checks are still running.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating my earlier approval after independently validating the existing finding: #6383 (comment)

The async check executes validator.is_valid synchronously without a suspension point or work bound. Accepted pattern/patternProperties schemas can therefore cause unbounded regex matching on model-controlled text, blocking other tasks and preventing an asyncio timeout from taking effect. A trusted application schema does not by itself bound regex matching complexity. Please constrain supported regex validation or move it behind a genuinely preemptible, bounded isolation boundary before approval.

This supersedes my earlier approval. Static review only, with independent confirmation; no candidate code or tests were executed. Referencing the existing inline finding rather than duplicating it.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex validation finding is addressed: pattern and patternProperties are rejected throughout schema subresources, and references are restricted to checked direct local definitions. Reviewed annotation-reference bypasses and ordinary data fields with those names.

No new actionable findings after independent static re-review. This approval supersedes my earlier request for changes. Hosted CI is still in progress; no candidate code or tests were executed locally.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acffba995f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: acffba995f

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseding my earlier approval after independently validating two additional existing findings:

  • Fractional multipleOf constraints can reject valid decimal JSON numbers because parsing and the pinned validator use binary-float division: #6383 (comment) . Please use decimal-safe validation for both instance values and schema constraints.
  • Permitted recursive references combined with branching schemas can repeatedly validate the same child, causing exponential synchronous work on model-controlled output. The regex restriction does not bound this work, and an asyncio timeout cannot preempt it: #6383 (comment) . Please reject unsafe recursive/multiplying schemas or enforce a preemptible work bound.

Static review with independent confirmation against the pinned validator implementation; no candidate code or tests were executed. Referencing existing inline findings rather than duplicating them.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both remaining findings are addressed. Schema and instance decimals now use exact Fraction/int arithmetic; recursive and multiplying reference expansions are bounded at construction, and candidate size/depth plus the combined schema/input budget are checked before validation. Reviewed the restriction and numeric boundary regressions, unsupported-keyword traversal, and existing acceptance behavior.

No new actionable findings after independent static re-review. This approval supersedes my request for changes. Hosted CI remains in progress; no candidate code or tests were executed locally.

@markstuart-oai
markstuart-oai merged commit 371e786 into v1-alpha Dec 3, 2026
28 checks passed
@markstuart-oai
markstuart-oai deleted the codex/v1-validated-json branch December 3, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants